package com.zhengsr.wanandroid.ui.main.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhengsr.corelib.bean.NaviSection;
import com.zhengsr.corelib.utils.CommonUtils;
import com.zhengsr.wanandroid.R;

import java.util.List;

/**
 * Created by zhengshaorui
 * Time on 2019/3/8
 */

public class NaviAdapter extends BaseSectionQuickAdapter<NaviSection,BaseViewHolder> {

    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param layoutResId      The layout resource id of each item.
     * @param sectionHeadResId The section head layout id for each item
     * @param data             A new list is created out of this one to avoid mutable list
     */
    public NaviAdapter(int layoutResId, int sectionHeadResId, List<NaviSection> data) {
        super(layoutResId, sectionHeadResId, data);
    }

    @Override
    protected void convertHead(BaseViewHolder helper, NaviSection item) {
        helper.setText(R.id.item_text_tv,item.header);
      //  Log.d(TAG, "zsr --> convertHead: "+item.header);
    }

    @Override
    protected void convert(BaseViewHolder helper, NaviSection item) {
      //  Log.d(TAG, "zsr --> convert: "+item.t.getTitle());
        TextView textView = helper.getView(R.id.item_text_navi_tv);
        textView.setText(item.t.getTitle());
        textView.setTextColor(CommonUtils.randomColor());

    }

}
